﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="catalogBanners.aspx.cs" Inherits="catalogBanners" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Catalogo Banners</title>
    <style type="text/css">
        .fontLabel
        {
            font-family: Calibri;
            font-size: medium;
        }
        .textField
        {
            padding-left: 15px;
        }
        .buttonExtNet
        {
            height: 22px;
            vertical-align: bottom;
        }
    </style>
    <script type="text/javascript">
        var messageLoading = 'Cargando...';
        function fnOnClick(sender, e) {
            if (e == 'Edit' || e == 'New') {
                var id = 0;
                if (e == 'Edit') {
                    id = sender.Id;
                }
                App.direct.ShowDetails(id);
            } else if (e == 'Delete') {
                var messageConfirm = 'Esta seguro que desea eliminar el Registro seleccionado?';
                var messageConfirmationTitle = 'Confirmacion';
                Ext.MessageBox.confirm(messageConfirmationTitle, messageConfirm, function (btn) {
                    if (btn == 'yes') {
                        if (sender.Id) {
                            App.direct.DeleteCategory(sender.Id);
                        }
                    }
                });
            }
        }
        var employeeDetailsRender = function () {
            return '<img class="imgEdit" ext:qtip="Click to view/edit additional details" style="cursor:pointer;" src="vcard_edit.png" />';
        };

        var cellClick = function (view, cell, columnIndex, record, row, rowIndex, e) {
            var t = e.getTarget(),
                columnId = this.columns[columnIndex].id; // Get column id

            if (t.className == "imgEdit" && columnId == "Details") {
                //the ajax call is allowed
                return true;
            }

            //forbidden
            return false;
        };

    </script>
</head>
<body>
    <form id="Form1" runat="server">
    <div>
        <ext:ResourceManager ID="ResourceManagerCatalog" runat="server" />
        <ext:Viewport ID="ViewPortSite" runat="server" Layout="FitLayout">
            <Items>
                <ext:Panel ID="Panel1" Layout="FitLayout" runat="server">
                    <TopBar>
                    </TopBar>
                    <Items>
                        <ext:TabPanel ID="tpanelBanners" runat="server" Layout="FitLayout" Margins="0 0 5 0"
                            EnableTabScroll="true">
                            <Items>
                                <ext:Panel ID="tabBannerHome" runat="server" Icon="Application" Border="false" Title="Home"
                                    Closable="false">
                                    <Items>
                                        <ext:FormPanel ID="pnlImageHome" runat="server" Title="Imagenes Banner Home" Icon="LayoutContent"
                                            DefaultAnchor="100%" BodyPadding="5">
                                            <Items>
                                                <ext:FieldSet ID="FieldSet1" runat="server">
                                                    <Items>
                                                        <ext:FieldContainer ID="fieldcontainer2" runat="server" Layout="HBoxLayout" Margin="10">
                                                            <Items>
                                                                <ext:TextField ID="txtlinkUrl" runat="server" FieldLabel="Link URL" Name="Id" />
                                                                <ext:FileUploadField ID="uploadField" runat="server" Width="400" Icon="Attach" AllowBlank="false"
                                                                    FieldLabel="Ubicacion">
                                                                </ext:FileUploadField>
                                                                <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
                                                                </ext:ToolbarSeparator>
                                                                <ext:Button ID="btnUploadImage" runat="server" Text="Subir Foto">
                                                                    <DirectEvents>
                                                                        <Click OnEvent="UploadClick" Before="if (!#{pnlImageHome}.getForm().isValid()) { return false; } 
                                                            Ext.Msg.wait('Cargando Imagen...', 'Cargando');" Failure="Ext.Msg.show({ 
                                                            title   : 'Error', 
                                                            msg     : 'Error during uploading', 
                                                            minWidth: 200, 
                                                            modal   : true, 
                                                            icon    : Ext.Msg.ERROR, 
                                                            buttons : Ext.Msg.OK 
                                                        });" After="#{txtlinkUrl}.setValue('');">
                                                                            <ExtraParams>
                                                                                <ext:Parameter Name="idbt" Value="1" Mode="Raw" />
                                                                                <ext:Parameter Name="linkUrl" Value="#{txtlinkUrl}.getValue()" Mode="Raw" />
                                                                            </ExtraParams>
                                                                        </Click>
                                                                    </DirectEvents>
                                                                </ext:Button>
                                                                <ext:DisplayField ID="dpfImageSizeCatHome" runat="server" LabelAlign="Right" />
                                                            </Items>
                                                        </ext:FieldContainer>
                                                        <ext:FieldContainer ID="fieldcontainer3" runat="server">
                                                            <Items>
                                                                <ext:GridPanel ID="gridImageHome" runat="server" ClientIDMode="Static" AutoScroll="true"
                                                                    AutoHeight="true" Border="true">
                                                                    <Store>
                                                                        <ext:Store ID="storeImagesHome" runat="server" FilterOnLoad="false">
                                                                            <Model>
                                                                                <ext:Model ID="Model5" runat="server" IDProperty="Id">
                                                                                    <Fields>
                                                                                        <ext:ModelField Name="Id" />
                                                                                        <ext:ModelField Name="LinkUrl" />
                                                                                        <ext:ModelField Name="url" />
                                                                                    </Fields>
                                                                                </ext:Model>
                                                                            </Model>
                                                                        </ext:Store>
                                                                    </Store>
                                                                    <ColumnModel>
                                                                        <Columns>
                                                                            <ext:TemplateColumn ID="TemplateColumn2" runat="server" Text="Archivo" Flex="15"
                                                                                DataIndex="url" TemplateString='<img style="width:60px;height:45px;" src="{url}" />' />
                                                                            <ext:Column ID="Column1" runat="server" Text="Id" Flex="35" DataIndex="Id" />
                                                                            <ext:Column ID="Column2" runat="server" Text="LinkUrl" Flex="35" DataIndex="LinkUrl" />
                                                                        </Columns>
                                                                    </ColumnModel>
                                                                    <Features>
                                                                        <ext:GridFilters Enabled="false">
                                                                        </ext:GridFilters>
                                                                    </Features>
                                                                    <View>
                                                                        <ext:GridView ID="GridView2" runat="server" EmptyText="No Images to Display" />
                                                                    </View>
                                                                    <SelectionModel>
                                                                        <ext:RowSelectionModel ID="RowSelectionModelHome" runat="server" Mode="Single" />
                                                                    </SelectionModel>
                                                                    <Buttons>
                                                                        <ext:Button ID="btnDeleteImage" runat="server" Text="Eliminar">
                                                                            <DirectEvents>
                                                                                <Click OnEvent="btnDeleteImage_Click">
                                                                                    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{tabBannerHome}.body}" />
                                                                                    <ExtraParams>
                                                                                        <ext:Parameter Name="idbt" Value="1" Mode="Raw" />
                                                                                        <ext:Parameter Name="idValues" Value="Ext.encode(#{gridImageHome}.getRowsValues({selectedOnly : true}))"
                                                                                            Mode="Raw" />
                                                                                    </ExtraParams>
                                                                                </Click>
                                                                            </DirectEvents>
                                                                        </ext:Button>
                                                                    </Buttons>
                                                                </ext:GridPanel>
                                                            </Items>
                                                        </ext:FieldContainer>
                                                    </Items>
                                                </ext:FieldSet>
                                            </Items>
                                        </ext:FormPanel>
                                    </Items>
                                </ext:Panel>
                                <ext:Panel ID="tabBannerTop" runat="server" Icon="Application" Border="false" Title="Banner Top">
                                    <Items>
                                        <ext:FormPanel ID="pnlImageTop" runat="server" Title="Imagenes Banner Top" Icon="LayoutContent"
                                            DefaultAnchor="100%" BodyPadding="5">
                                            <Items>
                                                <ext:FieldSet ID="FieldSet2" runat="server">
                                                    <Items>
                                                        <ext:FieldContainer ID="fieldcontainer1" runat="server" Layout="HBoxLayout" Margin="10">
                                                            <Items>
                                                                <ext:TextField ID="txtlinkUrlTop" runat="server" FieldLabel="Link URL" Name="Id" />
                                                                <ext:FileUploadField ID="uploadFieldTop" runat="server" Width="400" Icon="Attach"
                                                                    AllowBlank="false" FieldLabel="Ubicacion">
                                                                </ext:FileUploadField>
                                                                <ext:ToolbarSeparator ID="ToolbarSeparator2" runat="server">
                                                                </ext:ToolbarSeparator>
                                                                <ext:Button ID="Button1" runat="server" Text="Subir Foto">
                                                                    <DirectEvents>
                                                                        <Click OnEvent="UploadClickTop" Before="if (!#{pnlImageTop}.getForm().isValid()) { return false; } 
                                                            Ext.Msg.wait('Cargando Imagen...', 'Cargando');" Failure="Ext.Msg.show({ 
                                                            title   : 'Error', 
                                                            msg     : 'Error during uploading', 
                                                            minWidth: 200, 
                                                            modal   : true, 
                                                            icon    : Ext.Msg.ERROR, 
                                                            buttons : Ext.Msg.OK 
                                                        });" After="#{txtlinkUrl}.setValue('');">
                                                                            <ExtraParams>
                                                                                <ext:Parameter Name="idbt" Value="2" Mode="Raw" />
                                                                                <ext:Parameter Name="linkUrl" Value="#{txtlinkUrlTop}.getValue()" Mode="Raw" />
                                                                            </ExtraParams>
                                                                        </Click>
                                                                    </DirectEvents>
                                                                </ext:Button>
                                                                <ext:DisplayField ID="dpfImageSizeCatTop" runat="server" LabelAlign="Right" />
                                                            </Items>
                                                        </ext:FieldContainer>
                                                        <ext:FieldContainer ID="fieldcontainer4" runat="server">
                                                            <Items>
                                                                <ext:GridPanel ID="gridImageTop" runat="server" ClientIDMode="Static" AutoScroll="true"
                                                                    AutoHeight="true" Border="true">
                                                                    <Store>
                                                                        <ext:Store ID="storeImagesTop" runat="server" FilterOnLoad="false">
                                                                            <Model>
                                                                                <ext:Model ID="Model1" runat="server" IDProperty="Id">
                                                                                    <Fields>
                                                                                        <ext:ModelField Name="Id" />
                                                                                        <ext:ModelField Name="LinkUrl" />
                                                                                        <ext:ModelField Name="url" />
                                                                                    </Fields>
                                                                                </ext:Model>
                                                                            </Model>
                                                                        </ext:Store>
                                                                    </Store>
                                                                    <ColumnModel>
                                                                        <Columns>
                                                                            <ext:TemplateColumn ID="TemplateColumn1" runat="server" Text="Archivo" Flex="15"
                                                                                DataIndex="url" TemplateString='<img style="width:60px;height:45px;" src="{url}" />' />
                                                                            <ext:Column ID="Column3" runat="server" Text="Id" Flex="35" DataIndex="Id" />
                                                                            <ext:Column ID="Column4" runat="server" Text="LinkUrl" Flex="35" DataIndex="LinkUrl" />
                                                                        </Columns>
                                                                    </ColumnModel>
                                                                    <Features>
                                                                        <ext:GridFilters Enabled="false">
                                                                        </ext:GridFilters>
                                                                    </Features>
                                                                    <View>
                                                                        <ext:GridView ID="GridView1" runat="server" EmptyText="No Images to Display" />
                                                                    </View>
                                                                    <SelectionModel>
                                                                        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single" />
                                                                    </SelectionModel>
                                                                    <Buttons>
                                                                        <ext:Button ID="Button2" runat="server" Text="Eliminar">
                                                                            <DirectEvents>
                                                                                <Click OnEvent="btnDeleteImage_Click">
                                                                                    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{tabBannerTop}.body}" />
                                                                                    <ExtraParams>
                                                                                        <ext:Parameter Name="idbt" Value="2" Mode="Raw" />
                                                                                        <ext:Parameter Name="idValues" Value="Ext.encode(#{gridImageTop}.getRowsValues({selectedOnly : true}))"
                                                                                            Mode="Raw" />
                                                                                    </ExtraParams>
                                                                                </Click>
                                                                            </DirectEvents>
                                                                        </ext:Button>
                                                                    </Buttons>
                                                                </ext:GridPanel>
                                                            </Items>
                                                        </ext:FieldContainer>
                                                    </Items>
                                                </ext:FieldSet>
                                            </Items>
                                        </ext:FormPanel>
                                    </Items>
                                </ext:Panel>
                                <ext:Panel ID="tabBannerMiddle" runat="server" Icon="Application" Border="false"
                                    Title="Banner Middle">
                                    <Items>
                                        <ext:FormPanel ID="pnlImageMiddle" runat="server" Title="Imagenes Banner Middle"
                                            Icon="LayoutContent" DefaultAnchor="100%" BodyPadding="5">
                                            <Items>
                                                <ext:FieldSet ID="FieldSet3" runat="server">
                                                    <Items>
                                                        <ext:FieldContainer ID="fieldcontainer5" runat="server" Layout="HBoxLayout" Margin="10">
                                                            <Items>
                                                                <ext:TextField ID="txtlinkUrlMiddle" runat="server" FieldLabel="Link URL" Name="Id" />
                                                                <ext:FileUploadField ID="uploadFieldMiddle" runat="server" Width="400" Icon="Attach"
                                                                    AllowBlank="false" FieldLabel="Ubicacion">
                                                                </ext:FileUploadField>
                                                                <ext:ToolbarSeparator ID="ToolbarSeparator3" runat="server">
                                                                </ext:ToolbarSeparator>
                                                                <ext:Button ID="Button3" runat="server" Text="Subir Foto">
                                                                    <DirectEvents>
                                                                        <Click OnEvent="UploadClickMiddle" Before="if (!#{pnlImageMiddle}.getForm().isValid()) { return false; } 
                                                            Ext.Msg.wait('Cargando Imagen...', 'Cargando');" Failure="Ext.Msg.show({ 
                                                            title   : 'Error', 
                                                            msg     : 'Error during uploading', 
                                                            minWidth: 200, 
                                                            modal   : true, 
                                                            icon    : Ext.Msg.ERROR, 
                                                            buttons : Ext.Msg.OK 
                                                        });" After="#{txtlinkUrl}.setValue('');">
                                                                            <ExtraParams>
                                                                                <ext:Parameter Name="idbt" Value="3" Mode="Raw" />
                                                                                <ext:Parameter Name="linkUrl" Value="#{txtlinkUrlMiddle}.getValue()" Mode="Raw" />
                                                                            </ExtraParams>
                                                                        </Click>
                                                                    </DirectEvents>
                                                                </ext:Button>
                                                                <ext:DisplayField ID="dpfImageSizeMiddle" runat="server" LabelAlign="Right" />
                                                            </Items>
                                                        </ext:FieldContainer>
                                                        <ext:FieldContainer ID="fieldcontainer6" runat="server">
                                                            <Items>
                                                                <ext:GridPanel ID="gridImageMiddle" runat="server" ClientIDMode="Static" AutoScroll="true"
                                                                    AutoHeight="true" Border="true">
                                                                    <Store>
                                                                        <ext:Store ID="storeImagesMiddle" runat="server" FilterOnLoad="false">
                                                                            <Model>
                                                                                <ext:Model ID="Model2" runat="server" IDProperty="Id">
                                                                                    <Fields>
                                                                                        <ext:ModelField Name="Id" />
                                                                                        <ext:ModelField Name="LinkUrl" />
                                                                                        <ext:ModelField Name="url" />
                                                                                    </Fields>
                                                                                </ext:Model>
                                                                            </Model>
                                                                        </ext:Store>
                                                                    </Store>
                                                                    <ColumnModel>
                                                                        <Columns>
                                                                            <ext:TemplateColumn ID="TemplateColumn3" runat="server" Text="Archivo" Flex="15"
                                                                                DataIndex="url" TemplateString='<img style="width:60px;height:45px;" src="{url}" />' />
                                                                            <ext:Column ID="Column5" runat="server" Text="Id" Flex="35" DataIndex="Id" />
                                                                            <ext:Column ID="Column6" runat="server" Text="LinkUrl" Flex="35" DataIndex="LinkUrl" />
                                                                        </Columns>
                                                                    </ColumnModel>
                                                                    <Features>
                                                                        <ext:GridFilters Enabled="false">
                                                                        </ext:GridFilters>
                                                                    </Features>
                                                                    <View>
                                                                        <ext:GridView ID="GridView3" runat="server" EmptyText="No Images to Display" />
                                                                    </View>
                                                                    <SelectionModel>
                                                                        <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" Mode="Single" />
                                                                    </SelectionModel>
                                                                    <Buttons>
                                                                        <ext:Button ID="Button4" runat="server" Text="Eliminar">
                                                                            <DirectEvents>
                                                                                <Click OnEvent="btnDeleteImage_Click">
                                                                                    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{tabBannerMiddle}.body}" />
                                                                                    <ExtraParams>
                                                                                        <ext:Parameter Name="idbt" Value="3" Mode="Raw" />
                                                                                        <ext:Parameter Name="idValues" Value="Ext.encode(#{gridImageMiddle}.getRowsValues({selectedOnly : true}))"
                                                                                            Mode="Raw" />
                                                                                    </ExtraParams>
                                                                                </Click>
                                                                            </DirectEvents>
                                                                        </ext:Button>
                                                                    </Buttons>
                                                                </ext:GridPanel>
                                                            </Items>
                                                        </ext:FieldContainer>
                                                    </Items>
                                                </ext:FieldSet>
                                            </Items>
                                        </ext:FormPanel>
                                    </Items>
                                </ext:Panel>
                                <ext:Panel ID="tabBannerBottom" runat="server" Icon="Application" Border="false"
                                    Title="Banner Bottom">
                                    <Items>
                                        <ext:FormPanel ID="pnlImageBottom" runat="server" Title="Imagenes Banner Bottom"
                                            Icon="LayoutContent" DefaultAnchor="100%" BodyPadding="5">
                                            <Items>
                                                <ext:FieldSet ID="FieldSet4" runat="server">
                                                    <Items>
                                                        <ext:FieldContainer ID="fieldcontainer7" runat="server" Layout="HBoxLayout" Margin="10">
                                                            <Items>
                                                                <ext:TextField ID="txtlinkUrlBottom" runat="server" FieldLabel="Link URL" Name="Id" />
                                                                <ext:FileUploadField ID="uploadFieldBottom" runat="server" Width="400" Icon="Attach"
                                                                    AllowBlank="false" FieldLabel="Ubicacion">
                                                                </ext:FileUploadField>
                                                                <ext:ToolbarSeparator ID="ToolbarSeparator4" runat="server">
                                                                </ext:ToolbarSeparator>
                                                                <ext:Button ID="Button5" runat="server" Text="Subir Foto">
                                                                    <DirectEvents>
                                                                        <Click OnEvent="UploadClickBottom" Before="if (!#{pnlImageBottom}.getForm().isValid()) { return false; } 
                                                            Ext.Msg.wait('Cargando Imagen...', 'Cargando');" Failure="Ext.Msg.show({ 
                                                            title   : 'Error', 
                                                            msg     : 'Error during uploading', 
                                                            minWidth: 200, 
                                                            modal   : true, 
                                                            icon    : Ext.Msg.ERROR, 
                                                            buttons : Ext.Msg.OK 
                                                        });" After="#{txtlinkUrl}.setValue('');">
                                                                            <ExtraParams>
                                                                                <ext:Parameter Name="idbt" Value="4" Mode="Raw" />
                                                                                <ext:Parameter Name="linkUrl" Value="#{txtlinkUrlBottom}.getValue()" Mode="Raw" />
                                                                            </ExtraParams>
                                                                        </Click>
                                                                    </DirectEvents>
                                                                </ext:Button>
                                                                <ext:DisplayField ID="dpfImageSizeBottom" runat="server" LabelAlign="Right" />
                                                            </Items>
                                                        </ext:FieldContainer>
                                                        <ext:FieldContainer ID="fieldcontainer8" runat="server">
                                                            <Items>
                                                                <ext:GridPanel ID="gridImageBottom" runat="server" ClientIDMode="Static" AutoScroll="true"
                                                                    AutoHeight="true" Border="true">
                                                                    <Store>
                                                                        <ext:Store ID="storeImagesBottom" runat="server" FilterOnLoad="false">
                                                                            <Model>
                                                                                <ext:Model ID="Model3" runat="server" IDProperty="Id">
                                                                                    <Fields>
                                                                                        <ext:ModelField Name="Id" />
                                                                                        <ext:ModelField Name="LinkUrl" />
                                                                                        <ext:ModelField Name="url" />
                                                                                    </Fields>
                                                                                </ext:Model>
                                                                            </Model>
                                                                        </ext:Store>
                                                                    </Store>
                                                                    <ColumnModel>
                                                                        <Columns>
                                                                            <ext:TemplateColumn ID="TemplateColumn4" runat="server" Text="Archivo" Flex="15"
                                                                                DataIndex="url" TemplateString='<img style="width:60px;height:45px;" src="{url}" />' />
                                                                            <ext:Column ID="Column7" runat="server" Text="Id" Flex="35" DataIndex="Id" />
                                                                            <ext:Column ID="Column8" runat="server" Text="LinkUrl" Flex="35" DataIndex="LinkUrl" />
                                                                        </Columns>
                                                                    </ColumnModel>
                                                                    <Features>
                                                                        <ext:GridFilters Enabled="false">
                                                                        </ext:GridFilters>
                                                                    </Features>
                                                                    <View>
                                                                        <ext:GridView ID="GridView4" runat="server" EmptyText="No Images to Display" />
                                                                    </View>
                                                                    <SelectionModel>
                                                                        <ext:RowSelectionModel ID="RowSelectionModel3" runat="server" Mode="Single" />
                                                                    </SelectionModel>
                                                                    <Buttons>
                                                                        <ext:Button ID="Button6" runat="server" Text="Eliminar">
                                                                            <DirectEvents>
                                                                                <Click OnEvent="btnDeleteImage_Click">
                                                                                    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{tabBannerBottom}.body}" />
                                                                                    <ExtraParams>
                                                                                        <ext:Parameter Name="idbt" Value="4" Mode="Raw" />
                                                                                        <ext:Parameter Name="idValues" Value="Ext.encode(#{gridImageBottom}.getRowsValues({selectedOnly : true}))"
                                                                                            Mode="Raw" />
                                                                                    </ExtraParams>
                                                                                </Click>
                                                                            </DirectEvents>
                                                                        </ext:Button>
                                                                    </Buttons>
                                                                </ext:GridPanel>
                                                            </Items>
                                                        </ext:FieldContainer>
                                                    </Items>
                                                </ext:FieldSet>
                                            </Items>
                                        </ext:FormPanel>
                                    </Items>
                                </ext:Panel>
                            </Items>
                        </ext:TabPanel>
                    </Items>
                </ext:Panel>
            </Items>
        </ext:Viewport>
    </div>
    </form>
</body>
</html>
